package com.shop.entity;


import lombok.Getter;

@Getter
public  class  Res <T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Res<T> success( T data ){
        Res<T> res = new Res();
        res.code = 200;
        res.msg = "成功";
        res.data = data;
        return res;
    }

    public static Res success(  ){
        Res res = new Res();
        res.code = 200;
        res.msg = "成功";
        return res;
    }

    public static <T> Res<T> error( T data ){
        Res<T> res = new Res();
        res.code = 500;
        res.msg = "错误";
        res.data = data;
        return res;
    }

    public static Res error(  ){
        Res res = new Res();
        res.code = 200;
        res.msg = "错误";
        return res;
    }

}
